package com.mcb.autopublish.demos.web.service.impl;

import com.mcb.autopublish.demos.web.convert.EntityConvert;
import com.mcb.autopublish.demos.web.dto.request.ArticleQuestionSonMcQueryRequest;
import com.mcb.autopublish.demos.web.dto.request.ArticleQuestionSonMcRequest;
import com.mcb.autopublish.demos.web.dto.response.ArticleQuestionSonMcResponse;
import com.mcb.autopublish.demos.web.mapper.ArticleQuestionSonMcMapper;
import com.mcb.autopublish.demos.web.po.ArticleQuestionSonMc;
import com.mcb.autopublish.demos.web.service.ArticleQuestionSonMcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author machengbang
 * @since 2024-06-12
 */
@Service
public class ArticleQuestionSonMcServiceImpl implements ArticleQuestionSonMcService {

    @Resource
    private ArticleQuestionSonMcMapper articleQuestionSonMcMapper;

    /**
   * 查询列表
   * @param request
   * @return
   */
    @Override
    public List<ArticleQuestionSonMcResponse> getArticleQuestionSonMcList(ArticleQuestionSonMcQueryRequest request){
        List<ArticleQuestionSonMcResponse> list = articleQuestionSonMcMapper.getArticleQuestionSonMcList();
        return list;
    }

    /**
     * 保存
     * @param request
     * @return
     */
    @Override
    public void saveArticleQuestionSonMc(ArticleQuestionSonMcRequest request){
        ArticleQuestionSonMc articleQuestionSonMc = EntityConvert.convertToEntity(ArticleQuestionSonMc.class, request);
        articleQuestionSonMcMapper.insert(articleQuestionSonMc);
    }

    /**
     * 更新
     * @param request
     * @return
     */
    @Override
    public void updateArticleQuestionSonMc(ArticleQuestionSonMcRequest request){
        ArticleQuestionSonMc articleQuestionSonMc = EntityConvert.convertToEntity(ArticleQuestionSonMc.class, request);
        articleQuestionSonMcMapper.updateById(articleQuestionSonMc);
    }

    /**
     * 删除
     * @param request
     * @return
     */
    @Override
    public void deleteArticleQuestionSonMc(ArticleQuestionSonMcRequest request){
       articleQuestionSonMcMapper.deleteById(request.getId());
    }
}
